package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:char(11);not null;comment:手机号"`
	Password string `gorm:"type:varchar(32);not null;comment:密码"`
}

func (u *User) FindMobile() error {
	return DB.Where("mobile = ?", u.Mobile).Find(&u).Error
}
func (u *User) Create() error {
	return DB.Create(&u).Error
}
func (u *User) FinduserId() error {
	return DB.Model(User{}).Where("id = ?", u.ID).Find(&u).Error
}
func (u *User) UpdatePassword() error {
	return DB.Model(u).Updates(&u).Error
}
